﻿xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "Page1_Data.xml", false);
xmlhttp.send();
xmlDoc = xmlhttp.responseXML;

x = xmlDoc.getElementsByTagName("person");
txt = "";

function Display_Comment(i) {
    txt += "<div>";
    name = (x[i].getElementsByTagName("name")[0].childNodes[0].nodeValue);
    email = (x[i].getElementsByTagName("email")[0].childNodes[0].nodeValue);
    comment = (x[i].getElementsByTagName("comment")[0].childNodes[0].nodeValue);
    txt += name + "<br />" + "<a href='mailto:" + email + "'>" + email + "</a><br />" + comment + "<br /><hr />";
    txt += "</div>";
}

function Display_All() {
    for (i = 0; i < x.length; i++) Display_Comment(i);
    document.getElementById("p2").innerHTML = txt;
}